home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-04 / vpi1_330.zip / MENU2.PRG < prev    next >
Text File  |  1991-12-30  |  3KB  |  91 lines

  1. ***************************************************************************
  2. **  MENU2.PRG
  3. **  (C) Copyright 1990-92, Sub Rosa Publishing Inc.
  4. **
  5. **  A demonstration program provided to VP-Info users.
  6. **  This program may be copied freely. If it is used in commercial code,
  7. **  please credit the source, Sub Rosa Publishing Inc.
  8. **
  9. **  MENU2 demonstrates the use of the MENU() function along with a variety
  10. **  of Info commands and functions.
  11. **
  12. **  MENU2 displays a menu, determines the choice made, and takes
  13. **  action depending both on the selection and the key used to make
  14. **  the selection.
  15. **
  16. **  MENU2 is compatible with all current versions of VP-Info.
  17. **
  18. **  Sid Bursten and Bernie Melman
  19. ***************************************************************************
  20. IF :color <> 7
  21.    SET color to 31; white on blue
  22. ENDIF
  23. SET WIDTH to 80
  24. COLOR :color,0,0,24,79,177    ;fill screen with pattern
  25. * 177 is the fill character ▒.
  26. COLOR 112,7,20,21,66          ;draw black box to become shadow
  27. WINDOW 6,18,19,62 DOUBLE COLOR :color   ;declare space for menu text
  28. ON escape
  29.    CURSOR 22,0
  30.    WINDOW
  31.    CANCEL
  32. ENDON
  33. DO WHILE t                    ;put main menu in an infinite loop
  34.    ERASE                      ;fills window with blanks
  35.    TEXT
  36.  
  37.              DEMO MAIN MENU
  38.  
  39.     0. Exit to Sample Programs Menu
  40.  
  41.     1. Branch 1 of sample program
  42.     2. Do not choose this option
  43.     3. Branch 3 - choose with function key
  44.     4. Do not choose this option
  45.     5. Run the demo program EDBROW
  46.     6. Exit to Conversational VP-Info
  47.     7. Return to Main Demonstration Menu
  48.    ENDTEXT
  49.    CURSOR 12,25 ; positions menu cursor over 1st character of 1st choice
  50.    selection=menu(7,37)      ;seven choices menu bar width 37
  51.    DO CASE
  52.    CASE selection=0 .or. :key=327  ; <home> key
  53.       CHAIN samples
  54.    CASE selection=1
  55.       IF :key = 13
  56.          @ 20,21 say " CHOSEN WITH ENTER KEY! Press any key. "
  57.       ELSE
  58.          IF :key < 255
  59.             @ 20,21 say " CHOSEN WITH KEY "+chr(:key)+"  Press any key. "
  60.          ELSE
  61.             @ 20,21 say " KEY WITH Info code "+str(:key,3)+" Press any key. "
  62.          ENDIF
  63.       ENDIF
  64.       dummy=inkey()         ;wait for keystroke
  65.       @ 20,21 say blank(40,205)
  66.    CASE selection=3
  67.       IF (:key < 315) .or. (:key > 324)
  68.          @ 20,21 say " NOT A Function KEY! Press any key. "
  69.       ELSE
  70.          @ 20,21 say " CHOSEN WITH F"+str(:key-314,2)+". Press any key. "
  71.       ENDIF
  72.       DUMMY = inkey()
  73.       @ 20,21 say blank(40,205)
  74.    CASE selection=5
  75.       CHAIN EDBROW
  76.    CASE selection=6
  77.       WINDOW                  ;reset window to full screen
  78.       ERASE                   ;clear screen
  79.       CANCEL
  80.    CASE selection=7
  81.       CHAIN samples
  82.       WINDOW                  ;reset window to full screen
  83.    OTHERWISE
  84.       @ 20,21 say " ILLEGAL CHOICE! Press any key. "
  85.       DUMMY = inkey()
  86.       @ 20,21 say blank(40,205)  ;205 rebuilds double box
  87.    ENDCASE
  88. ENDDO
  89. *
  90. *                         *** end of MENU.PRG ***
  91.